{% extends "home/common/layout.html" %}

{% block content %}
<section class="content">
    <div class="page-header">
        <h3>部门管理
        {% if set_flag %}
        <a class="btn btn-primary pull-right add_dept">
                <i class="fa fa-plus" aria-hidden="true"></i>部门
        </a>
        {% endif %}
        </h3>
    </div>
    <div class="row">
        <div class="col-md-12 col-lg-12">
            <div class="box">
                <div class="box-body table-responsive no-padding dept_list_wrap" >
                    <table class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th width="6%">ID</th>
                            <th>部门</th>
                            <th width="6%">状态</th>
                            <th width="14%">创建时间</th>
                            <th width="14%">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% if list %}
                        {% for item in list %}
                        <tr>
                            <td>{{ item.id }}</td>
                            <td class="overflow_dot">
                                {% if item.pid %}
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ item.name }}
                                {% else %}
                                {{ item.name }}
                                {% endif %}

                            </td>
                            <td>
                                <span class="label {% if item.status == 1 %} label-success {% else %} label-danger {% endif %} ">
                                {{ CommonConstant.common_status_map[ item.status ] }}
                                </span>
                            </td>

                            <td>{{ item.created_time }}</td>
                            <td>
                                {% if set_flag %}
                                <a class="btn btn-link edit_dept" data-id="{{ item.id }}">修改</a>
                                {% endif %}
                                {% if ops_flag %}
                                    {% if item.status == 1 %}
                                    <a class="btn btn-link ops" data-id="{{ item.id }}" data-act="del">删除</a>
                                    {% else %}
                                    <a class="btn btn-link ops" data-id="{{ item.id }}" data-act="recovery">恢复</a>
                                    {% endif %}
                                {% endif %}
                            </td>
                        </tr>
                        {% endfor %}
                        {% else %}
                        <tr>
                            <td colspan="5" class="text-center">(＞﹏＜)没有数据</td>
                        </tr>
                        {% endif %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</section>

{% endblock %}

{%block js %}
<script src="{{ GlobalUrlService.buildWWWStaticUrl('/js/home/rbac/dept/index.js') }}"></script>
{% endblock %}